#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef string vextype;

typedef struct
{
    vextype vexs[n];
    int arcs[n][n];
    int vexnum, arcnum;
} AMGraph;

int visited[n]; //初值为FALSE
void DFS(AMGraph G, int i)
{
    cout << G.vertices[i].data;
    visited[i] = 1;
    ArcNode *p = G.vertices[i].firstarc;
    while (p != NULL)
    {
        int w = p->adjvex;
        if (!visited[w])
            DFS(G, w);
        p = p->nextarc;
    }
}

void DFSTraverse(AMGraph G)
{ // 对图 G 作深度优先遍历。
    for (int v = 0; v < G.vexnum; ++v)
        visited[v] = 0;
    for (int v = 0; v < G.vexnum; ++v)
        if (!visited[v])
            DFS(G, v);
    // 对尚未访问的顶点调用DFS
}
